/* Copyright © 2010 LPRM
Universidade Federal do Espírito Santo - RNP-GT CWTools

This file is part of JoinUs!.

JoinUs! is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

JoinUs! is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with JoinUs!. If not, see <http://www.gnu.org/licenses/>. */
package br.ufes.cwtools.joinus.home.core;

import java.util.Date;

import br.ufes.cwtools.joinus.util.DBHelper;

import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

public class Invitations {
	static final int NONE=0, WAITING_RESPONSE=1, REQUEST_DENIED=2, JOINED=3, INVITATION_IGNORED=4;
	private String campName, authorName, desc;
	Date expDate;
	long id;
	int status;
	
	public static Invitations[] fromXml(String xml) { return null; } //TODO
	public String toXml() { return null; } //TODO
	public boolean toDataBase(SQLiteDatabase db) {
		try {
			DBHelper toRecord = new DBHelper();
			toRecord.onCreate(db);
			db.execSQL("INSERT INTO activeInvitations(id, campName, authorName, desc, expDate, status) values("+
					id+", '"+campName+"', '"+authorName+"', "+desc+" ,'"+expDate.toString()+"', "+status+");");
			
			return true;
		} catch (SQLException e) {
			Log.d("DEBUG","db 4 error");
			return false;
		}
	}
	public static Invitations[] fromDataBase() { return null; } //TODO
}
